package com.mall.db.api;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.mall.db.mapper.PmsProductCategoryAttributeRelationMapper;
import com.mall.domain.PmsProductCategoryAttributeRelation;
import com.mall.interface1.api.PmsProductCategoryAttributeRelationApi;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

@DubboService
public class PmsProductCategoryAttributeRelationApiImpl implements PmsProductCategoryAttributeRelationApi {

    @Autowired
    private PmsProductCategoryAttributeRelationMapper relationMapper;

    @Override
    public void add(PmsProductCategoryAttributeRelation pmsProductCategoryAttributeRelation) {
        relationMapper.insert(pmsProductCategoryAttributeRelation);
    }

    @Override
    public void deleteByCategoryId(Long id) {
        LambdaQueryWrapper<PmsProductCategoryAttributeRelation> qw = new LambdaQueryWrapper<>();
        qw.eq(PmsProductCategoryAttributeRelation::getProductCategoryId,id);

        relationMapper.delete(qw);
    }
}
